<?php

	$files = scandir(".");
	$imagefiles = array();
	foreach( $files as $file ) {
		$split = explode(".", $file);
		if ( $split[count($split)-1] == "png" ) $imagefiles[] = $file;
	}
	$totalWidth = 0;
	$totalHeight = 16;
	$imageWidth = 16;
	$imageHeight = 16;
	foreach( $imagefiles as $file ) {
		$info = getImageSize($file);
		$totalWidth += $info[0];
	}

	$canvas = imageCreateTrueColor($totalWidth,$imageHeight);
	imagealphablending( $canvas, false );

	$i = 0;
	foreach( $imagefiles as $file ) {
		$image = imagecreatefrompng($file);
		imagecopy( $canvas, $image, ($i * $imageWidth), 0, 0, 0, $imageWidth, $imageHeight );
		$i++;
	}

	header( "Content-Type: image/png" );
	imagesavealpha( $canvas, true );
	imagepng( $canvas );

	imagedestroy($canvas);
	foreach( $images as $image ) imagedestroy( $image );
?>
